<div class="fadeIn">
    <br>
    <ol class="breadcrumb">
        <li class="active"><span class="glyphicon glyphicon-home" style="color:#23527c"></span>&nbsp;<mainpage></mainpage></li>
        <li class="active">系统管理 / 用户管理</li>
    </ol>

        <div class="marB15 clearfix">
            <form action="users/out-excel" method="post" id="form" name="myform">
            <div class="marT15 marR10 left">
                <span class="search-name">姓名：</span>
                <input type="text" class="form-control1" placeholder="" 
                ng-keyup='search($event)'
                ng-model="searchData.userName">
            </div>
            <div class="marT15 marR10 left">
                <span class="search-name">电话：</span>
                <input type="text" class="form-control1 phones" placeholder="" ng-model="searchData.phoneNumber">
            </div>
            <div class="marT15 marR10 left">
                <span class="search-name">归属单位</span>
                <select class="form-control1" ng-model="pddData.deptName">
                    <option value="">全部</option>
                    <option value={{row.deptId}} ng-repeat="row in listData1">{{row.deptName}}</option>
                </select>
            </div>
            </form>
            <button class="btn btn-sm btn-primary left marT15" id="search" ng-click='search()'><span class="glyphicon glyphicon-search"></span></button>
        </div>


  <div class="table-box">
    <table class="table table-bordered table-striped text-center bg-info">
        <thead >
        <tr class="info">
            <th class="text-center" >用户名</th>
            <th class="text-center">姓名</th>
            <th class="text-center">性别</th>
            <th class="text-center">电话</th>
            <th class="text-center">邮箱</th>
            <th class="text-center">归属单位</th>
            <th class="text-center">拥有角色</th>
            <th class="text-center">创建时间</th>
            <th class="text-center">状态</th>
            <th class="text-center">操作</th>
            <th class="text-center">用户说明</th>
            <th class="text-center">在线状态</th>

        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in result">
            <td class="w70">
                <a data-toggle="modal" data-target=".bs-example-modal"  ng-click="editTr('修改',item.userId)">{{item.userId}}</a>
            </td>
            <td class="w70">{{item.userName}}</td>
            <td>
                <p ng-if='"1"==item.sex' >女</p>
                <p ng-if='"2"==item.sex' >男</p>
            </td>
            <td class="w70">{{item.phoneNumber }}</td>
            <td class="w85">{{item.mailBox}}</td>
            <td class="w85">{{item.deptName }}</td>
            <td class="w85"><a data-toggle="modal"  data-target=".bs-example-moda3" ng-click="roleData(item.userId)">{{item.roleNames}}</a></td>
            <td class="w85">{{item.insertTime}}</td>
            <td>
                <p ng-if='"1"==item.status' >有效</p>
                <p ng-if='"0"==item.status' >失效</p>
            </td>
            <td style="min-width: 150px">
                <a class="marR10"
                   ng-click='changeStstus($index,item.userId ,item.status)'
                   ng-show="'0'===item.status">生效</a>
                <a class="marR10"
                   ng-click='changeStstus($index,item.userId ,item.status)'
                   ng-show="'1'===item.status">冻结</a>
                <a  class="marR10" data-toggle="modal" data-target="#delete" ng-click='delete(item.userId ,$index)'>删除</a>
                <!-- <a ng-show='item.onlineStatus=="1"' ng-click="exitUser(item.userId)">退出</a> -->

            </td>

            <td style="min-width: 200px; word-break: break-all;">{{item.remark }} </td>
            <td class="w115">{{item.onlineStatusStr}}</td>
        </tr>
        <tr>
            <td><a class="glyphicon glyphicon-plus" data-toggle="modal" data-target=".bs-example-modal" type="button" value="添加新用户" ng-click="editTr('添加')"></a></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        </tbody>

    </table>
    </div>


   <page></page>
</div>
<!-- 提示框 -->
<div class="modal fade" id="delete">
    <div class="modal-dialog">
        <div class="modal-content message_align">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">提示信息</h4>
            </div>
            <div class="modal-body">
                <p>您确认删除吗？</p>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="url"/>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <a  ng-click="deleteTr()" class="btn btn-primary" data-dismiss="modal">确定</a>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- 提示框结束 -->
<div class="modal fade bs-example-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog " role="document" style="width: 600px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">{{popup}}用户信息</h4>
            </div>
            <div class="modal-body" id="addpop">
                        <div class="row marB15">
                            <div class="col-xs-6 lineH25">
                                <label class="left" >登录工号：</label>
                                <input type="text" class="form-control right line4 name" placeholder="" ng-model="addData.userId" ng-show="popup=='添加'" >
                                <input type="text" class="form-control line4 right name" placeholder="" ng-model="addData.userId" ng-show="popup=='修改'" disabled>
                            </div>
                            <div class="col-xs-6 lineH25">
                                <label class="left">用户名：</label>
                                <input type="text" class="form-control line4 right name" placeholder="" ng-model="addData.userName">
                            </div>
                        </div>
    
                        <div class="row marB15">
                            <div class="col-xs-6 lineH25">
                                <label class="left">电话：</label>
                                <input type="number" class="form-control line4 right phone" id="phones" ng-model="addData.phoneNumber">
                            </div>
                            <div class="col-xs-6 lineH25">
                                <label class="left">邮箱：</label>
                                <input type="text" class="form-control line4 right email" placeholder="" ng-model="addData.mailBox">
                            </div>
                        </div>
                     
                        <div class="row marB15">
                             <div class="col-xs-6 lineH25">
                                <label class="left">性别：</label>
                                <select class="form-control line4 right sex" ng-model="addData.sex">
                                    <option value="2">男</option>
                                    <option value="1">女</option>
                                </select>
                            </div>
                            <div class="col-xs-6 lineH25">
                                <label class="left">归属单位：</label>
                                <select class="form-control line4 right unit"  ng-model="addData.deptId">
                                    <option value={{row.deptId}} ng-repeat="row in listData1">{{row.deptName }}</option>
                                </select>
                            </div>
                        </div>

                        <div class="row marB15">
                            
                            <div class="col-xs-6 lineH25">
                                <label class="left">初始密码：</label>
                                <input type="password" class="form-control line4 right" id="addpwd" placeholder="CSmm123456" ng-model="addData.pwd">
                                
                            </div>
                            <div class="col-xs-6">
                                <button class="btn-sm btn-primary left" ng-click="adtpow()" ng-show="popup=='修改'">密码初始化</button>
                            </div>
                        </div>
                     
                        <div class="row">
                           <div class="col-xs-12">
                               <p><label>说明：</label></p>                           
                            <textarea class="form-control col-xs-12" ng-model="addData.remark"></textarea>
                           </div>
                                                        
                        </div>
                        <br>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click='editSave()'  >保存</button>
            </div>


        </div>
    </div>
</div>

<div class="modal fade bs-example-moda3" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" >
    <div class="modal-dialog modal-lg " role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" >授权角色</h4>
            </div>
            <div class="modal-body" style="overflow: auto;height: 300px" >
                <div class="row">

                    <div class="col-md-push-1 col-md-8 form-group ">
                        <div class="form-group">
                            <label >请勾选要给用户要授权的角色</label>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" value="" ng-model="all">
                                    全选
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class=" col-md-3 form-group ">
                        <a class="btn form-control btn-primary middle change" type="button"
                         ng-click='linkTo();'>角色创建</a>
                    </div>

                </div>
                <table class="table table-bordered table-striped text-center bg-info"  >
                    <thead >
                    <tr class="info">
                        <th class="text-center">序号</th>
                        <th class="text-center">选择</th>
                        <th class="text-center">角色名称</th>
                        <th class="text-center">角色访问数据范围</th>
                        <th class="text-center">角色说明</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="row in result2">
                        <td>{{$index+1}}</td>
                        <td>
                            <input type="checkbox" class="checkbox checked" ng-checked="all">
                        </td>
                        <td><a data-toggle="modal" data-target=".bs-example-moda4" type="button" ng-click="quanData(row.roleId)">{{row.roleName}}</a></td>
                        <td>
                             <span ng-show="row.acsFlag=='1'">所有数据</span>
                             <span ng-show="row.acsFlag=='0'">本单位数据</span>
                        </td>
                        <td>{{row.remark}}</td>

                    </tr>
                    </tbody>
                </table>

                <br>
                <br>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click="saveData()">保存</button>
            </div>


        </div>
    </div>
</div>

<div class="modal fade bs-example-moda4" >
    <div class="modal-dialog">
        <div class="modal-content message_align">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">查看权限</h4>
            </div>
            <div class="modal-body">
                <div>
                    <ul id="treeDemo" class="ztree"></ul>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消查看</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- 加载框 -->
  <span class='loaded' ng-show='loaded'><img  src="img/load.gif"></span>
<!-- 加载框 完成-->